/**
 * Copyright 2025 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

@use '@angular/material' as mat;

.trace-wrapper {
  padding-left: 25px;
  padding-right: 25px;

  .empty-state {
    padding-top: 1em;
    text-align: center;
    font-style: italic;
  }
}

.trace-container {
  width: 100%;
  white-space: nowrap;
  font-size: 12px;
}

.trace-title {
  color: var(--trace-tab-trace-title-color);
  font-size: 14px;
  font-style: normal;
  font-weight: 700;
  line-height: 20px;
  letter-spacing: 0px;
}

.trace-label {
  width: 400px;
  color: var(--trace-tab-trace-label-color);
  text-overflow: ellipsis;
  font-family: 'Google Sans Mono', monospace;
  font-size: 14px;
  font-style: normal;
  font-weight: 500;
  line-height: 20px;
  letter-spacing: 0px;
}

.trace-bar-container {
  width: 50vw;
  position: relative;
  height: 16px;
}

.trace-bar {
  position: absolute;
  height: 18px;
  background-color: var(--trace-tab-trace-bar-background-color);
  border-radius: 4px;
  padding-left: 4px;
  overflow: hidden;
  font-size: 11px;
  line-height: 16px;
  color: var(--trace-tab-trace-bar-color);
  font-family: 'Google Sans';
}

.trace-duration {
  color: var(--trace-tab-trace-duration-color);
  font-weight: normal;
  margin-left: 4px;
}

.trace-row {
  display: flex;
  align-items: stretch;
  /* <-- stretch ensures full height */
  position: relative;
  height: 32px;
  /* Give rows a little more vertical space */
}

.trace-indent {
  display: flex;
  flex-shrink: 0;
  height: 100%;
  /* Make sure it stretches */
}

.indent-connector {
  width: 20px;
  position: relative;
  height: 100%;
}

.vertical-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 9px;
  width: 1px;
  background-color: var(--trace-tab-vertical-line-background-color);
}

.horizontal-line {
  position: absolute;
  top: 50%;
  left: 9px;
  width: 10px;
  height: 1px;
  background-color: var(--trace-tab-horizontal-line-background-color);
}

.trace-item {
  margin-top: 5px;
  @include mat.expansion-overrides(
    (
      container-background-color:
        var(--trace-tab-trace-item-container-background-color),
      header-focus-state-layer-color:
        var(--trace-tab-trace-item-header-focus-state-layer-color),
      header-description-color:
        var(--trace-tab-trace-item-header-description-color),
      header-text-size: 15,
    )
  );

  ::ng-deep .mat-expansion-panel-header.mat-expanded:focus {
    background-color: var(
      --trace-tab-mat-expansion-panel-header-focus-background-color
    );
  }

  ::ng-deep .mat-expansion-panel-header.mat-expanded {
    background-color: var(
      --trace-tab-mat-expansion-panel-header-background-color
    );
  }

  ::ng-deep .mat-expansion-panel-header.mat-expanded:hover {
    background-color: var(
      --trace-tab-mat-expansion-panel-header-hover-background-color
    );
  }
}

::ng-deep .mat-expansion-panel-header-title {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

::ng-deep .mat-expansion-panel-header-description {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
